<#include "../../base.ftl"/>

<#macro title>
物流交易系统
</#macro>
<#macro cssfile>
</#macro>
<#macro scriptfile>
</#macro>
<#macro jsscript>
$(function(){
	$("#price").removeAttr().val("");
	$("#weight").removeAttr().val("");
	$("#volume").removeAttr().val("");
	$("#age").removeAttr().val("");
	$("#time").removeAttr().val("");
	$("#remark").removeAttr().val("");
	$("#distance").removeAttr().val("");
})
  function checPrice(){
	var price=$("#price").val();
	if(price.length==0){
		$('#price1').html('不能为空');
		return false;
	}else{
		$('#price1').html('');
		return true;
	}
	
}

function checkWeight(){
	var weight=$("#weight").val();
	if(weight.length==0){
		$('#weight1').html('重量不能为空');
	 return false;
	}else{
		$('#weight1').html('吨');
		return true;
	}
	
}
 function checkVolumn(){
	 var volume=$("#volume").val();
	 if(volume.length==0){
		 $("#volume1").html('不能为空');
		 return false;
	 }else{
		 $("#volume1").html('');
		 return true;

	 }
	 
 }
 
 function checkAge(){
	 var age=$("#age").val();
	 if(age.length==0){
		 $("#age1").html('年龄不能为空');
		 return false;
	 }else{
		 $("#age1").html('年');
		 return true;
	 }
	 
 }
 
 function checkTime(){
	 var time=$("#time").val();
	 if(time.length==0){
		 $("#time1").html('不能为空');
		 return false;
	 }else{
		 $("#time1").html('');
		 return true;
	 }
	 
 }

 function checkArriveTime(){
	 var arriveTime=$('#arriveTime').val();
	 if(arriveTime.length==0){
		 $("#arriveTime1").html("时间不能为空");
	    return false;
	 }else{
		 $("#arriveTime1").html('');
	    return true;
	 }
	 
	 
	 
 }
 
 function checkDistance(){
	 var distance=$('#distance').val();
	 if(distance.length==0){
		 $("#distance1").html("不能为空");
		 return false;
	 }else{
		 $("#distance1").html('');
		 return true;
	 }
 }
 
    addressInit('cmbProvince', 'cmbCity', 'cmbArea', '北京', '市辖区', '东城区');
	$('#submit').click(function(){
       var unit=$("#unit").val();
       var distance=$("#distance").val();
       var machining=$("#machining").val();
       var measure=$("#measure").val();
       var price=$("#price").val();
       var delivery=$("#delivery").val();
       var volume=$("#volume").val();
       var time=$("#time").val();
       var cmbProvince=$("#cmbProvince").val();
       var cmbCity=$("#cmbCity").val();
       var cmbArea=$("#cmbArea").val();
       var remark=$("#remark").val();
       if(distance.length==0||price.length==0||volume.length==0||time.length==0){
    	   alert("请完整信息");
    	   return false
       }else{
       $.ajax({
              url: '${request.contextPath}/operator/tlt/TltStorageSupply/operator.html', 
    	      type:'post',
              data:{"oper":"add","availableVolume":volume,'unitPrice':price,'unit':unit,'hasMonitor':measure,'processCapability':machining,'provideDispatch':delivery,'minRentDay':time,'warehouseAddress':cmbProvince+cmbCity+cmbArea,'dockDistance':distance,'remark':remark},
              dataType : 'json',
              success:function(result){
        	      alert(result.message);
        	      $("#price").removeAttr().val("");
        	  	$("#weight").removeAttr().val("");
        	  	$("#volume").removeAttr().val("");
        	  	$("#time").removeAttr().val("");
        	  	$("#remark").removeAttr().val("");
        	  	$("#distance").removeAttr().val("");
        	  	window.location.href="index.html";
               },
             'error':function(xhr,e1,e2){
    	             alert("操作有误");
               }
           });
       
       }
    
	})
</#macro>
<#macro main>
<div class="span11" style="margin-top: 20px;margin-left:70px">
        <legend class="">仓储供应信息---新增信息</legend>
		<table class="table table-bordered">
              <tbody>
              <tr>
              
                <td>
          		<div class="control-group form-horizontal">
            	<label class="control-label">计量单位</label>
            <div class="controls">
                <select class="input-xlarge" style="width:285px;" id="unit">
                    <option>吨</option>
                    <option>20GP/F</option>
                    <option>40GP/F</option>
                </select>
            </div>
        		</div>
          </td>
          <td>
  		<div class="control-group form-horizontal">
    	<label class="control-label">仓库地址</label>
          <div class="controls">
                                                            省&nbsp;&nbsp;
          <select name="zy" class="span3" id="cmbProvince">
                       </select>
                                                         &nbsp;&nbsp;市
          <select name="zy" class="span3" id="cmbCity">
                       </select>&nbsp;&nbsp;区
          <select name="zy" class="span3" id="cmbArea">
                       </select>
           </div>
    
		   </div>
          </td>
              </tr>
                <tr>
                  <td>
                  		<div class="control-group form-horizontal">
                    	<!-- Text input-->
                        <label class="control-label" for="input01">价格</label>
                        <div class="controls">
                            <input id="price" placeholder="价格" class="input-xlarge" type="text" onkeyup="value=value.replace(/[^\d.]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d.]/g,''))" onblur="checPrice();"/>
                            <span id="price1" style="color:red"></span>
                        </div>
                		</div>
                  </td>
                  <td>
            		<div class="control-group form-horizontal">
              	    <label class="control-label">离最近水运码头距离</label>
                      <div class="controls">
                        <input id="distance" placeholder="离最近水运码头距离" type="text" onkeyup="value=value.replace(/[^\d.]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d.]/g,''))" onblur="checkDistance();"/>
                       <span id="distance1" style="color:red"><font color="#ff0000" size="2">&nbsp;&nbsp;公里</font></span>
                   </div>
                   </div>
                  </td>
                </tr>
                <tr>
                  <td>
                  		<div class="control-group form-horizontal">
                    	<!-- Text input-->
                        <label class="control-label" for="input01">可用仓库容积</label>
                        <div class="controls">
                            <input id="volume" placeholder="可用仓库容积" class="input-xlarge" type="text" onkeyup="value=value.replace(/[^\d.]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d.]/g,''))" onblur="checkVolumn();"/>
                            <span id="volume1" style="color:red"></span>
                        </div>
                		</div>
                  </td>
                  <td>
            		<div class="control-group form-horizontal">
              	    <label class="control-label">是否提供监控</label>
                    <div class="controls">
                    <select class="input-xlarge" style="width:285px;" id="measure">
                      <option>否</option>
                      <option>是</option>
                    </select>
                    </div>
          		    </div>
                  </td>
               </tr>
               <tr>
                 <td>
            		<div class="control-group form-horizontal">
              	<label class="control-label">是否具备库内加工能力</label>
              <div class="controls">
                  <select class="input-xlarge" style="width:285px;" id="machining">
                      <option>否</option>
                      <option>是</option>
                  </select>
              </div>
          		</div>
            </td>
            <td>
            		<div class="control-group form-horizontal">
              	<label class="control-label">是否可提供短程配送</label>
              <div class="controls">
                  <select class="input-xlarge" style="width:285px;" id="delivery">
                      <option>否</option>
                      <option>是</option>
                  </select>
              </div>
          </div>
            </td>
          </tr>
                <tr>
                 <td>
                  		<div class="control-group form-horizontal">
                    	<!-- Text input-->
                        <label class="control-label" for="input01">要求最短租用时间</label>
                        <div class="controls">
                            <input id="time" type="text" placeholder="最短租用时间" onkeyup="value=value.replace(/[^\d.]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d.]/g,''))" onblur="checkTime();"/>
                            <span id="time1" style="color:red"><font color="#ff0000" size="2">&nbsp;&nbsp;天</font></span>
                        </div>
                		</div>
                  </td>
                  <td>
            		<div class="control-group form-horizontal">
              	<!-- Textarea-->
                  <label class="control-label" for="input01">备注</label>
                  <div class="controls">
                  <div class="textarea">
                      <textarea type="" class="" style="width:270px;" id="remark"> </textarea>
                  </div>
                 </div>
          		 </div>
                </td>
                </tr>
                <tr>
                  <td colspan="2">
                  		<button class="btn btn-large btn-block btn-primary" type="button" id="submit">提交</button>
                  </td>
                </tr>
              </tbody>
            </table>

        </div><!--/span-->
</#macro>